package com.tk.method;

public class Demo04 {
    public static void main(String[] args) {
        //调用可变参数的方法
        printMax(1,20,56,3,2);
        printMax(new double[]{20,30,25,10});
    }

    public static void printMax(double... nums) {
        if (nums.length == 0) {
            System.out.println("No nums");
            return;
        }

        double result = nums[0];
        //排序
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] > result) {
                result = nums[i];
            }
        }
        System.out.println("最大的值是：" + result);
    }
}
